import { resTabs, appTabs, conTabs } from '@/consts/codesMap'

export const state = () => ({
  user_role: '' || localStorage.getItem('user_role'),
  loginBox: 'login',
  shrinked: true,
  resTabs,
  currentResTab: {

  },
  appTabs,
  currentAppTab: {
    
  },
  conTabs,
  currentConTab: {

  },
  altered: '' || localStorage.getItem('altered') // 用用户登录是-1 未知，只有客户有
})

export const getters = ()=>({
  userRole :(state)=> state.user_role,
  altered: (state)=>state.altered

})
export const mutations = {
  setState(state, { name, value }) {
    state[name] = value
  },

  //
  handleUserRole:(state,user_role)=>{
    state.user_role = user_role
    localStorage.setItem('user_role',user_role)
  },
  handleAltered:(state,altered)=>{
    state.altered = altered
    localStorage.setItem('altered',altered)
  }
}